package com.runner.utility;

import com.runner.observer.Event;
import com.runner.observer.Subject;

public class TimedEvent {
	private float maxTime;
	private float time;
	private Event event;
	private Subject subject;
	private boolean done;

	public TimedEvent(float maxTime, float time, Event event, Subject subject) {
		this.maxTime = maxTime;
		this.time = time;
		this.event = event;
		this.subject = subject;
		done = false;
	}

	public void update(float delta) {
		time += delta;
		if (time > maxTime) {
			subject.notify(event);
			done = true;
		}
	}

	public boolean isDone() {
		return done;
	}
}
